using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public delegate void VoidDelegate();
public class EventDispatcher
{
    private static List<VoidDelegate> Login_List;
    public static event VoidDelegate Login_Register
    {
        add
        {
            if (value != null)
            {
                if (Login_List == null)
                {
                    Login_List = new List<VoidDelegate>();
                }
                Login_List.Add(value);
            }
        }
        remove
        {
            if (value!=null)
            {
                for (int i = 0; i < Login_List.Count; i++)
                {
                    if (Login_List[i]!=null&&Login_List[i].Equals(value))
                    {
                        Login_List.RemoveAt(i);
                        break;
                    }
                }
            }
        }
    }
    public static void Login_Dispatch()
    {
        if (Login_List==null)
        {
            return;
        }
        foreach (var @event in Login_List)
        {
            @event?.Invoke();
        }
    }

}
